const util = require('util')
const axios = require('axios')
const {AuthFailed} = require('../../core/httpException')
const {appId, appSecret,loginUrl} = require('../config/config').wx


class WXManager {

  static async codeToToken(code) {
    const url = util.format(loginUrl, appId, appSecret, code)
    const result = await axios.get(url)

    if (result.status !== 200) {
      throw new AuthFailed('openid获取失败！')
    }
    if (result.data.errcode !== 0) {

    }


  }



}